<template>
<h1>日志一览</h1>
<el-table :data="logList" stripe>
  <el-table-column prop="logDate" label="日期"></el-table-column>
  <el-table-column prop="logContent" label="内容"></el-table-column>
</el-table>
  <el-pagination v-model:current-page="curPage" v-model:page-size="pageSize" background
                 :total="total" @current-change="reload"></el-pagination>

  <div>
    <span>起始日期</span>
    <el-date-picker v-model="startDate" type="date" value-format="YYYY-MM-DD"
                    placeholder="请选择起始日期">
    </el-date-picker>
    <span>结束日期</span>
    <el-date-picker v-model="endDate" type="date" value-format="YYYY-MM-DD"
                    placeholder="请选择结束日期">
    </el-date-picker>
    <el-button type="primary" @click="reload">查找</el-button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  created() {
    this.reload()
  },
  name: "Log",
  data(){
    return{
      logList:[],
      curPage:1,
      pageSize:10,
      total:0,
      startDate:'',
      endDate:''
    }
  },
  methods:{
    reload(){
     let param = {
       "pageNo" : this.curPage,
       "pageSize" : this.pageSize,
       "startDate" : this.startDate,
       "endDate" : this.endDate
     }
     axios.post("/api/log/findLogsByPage",param).then(response=>{
       let data = response.data.data;
       this.logList = data.records;
       this.total =data.total;
     })
    }
  }
}
</script>

<style scoped>

</style>